//public class LogIn {
//    private String userName = "admin";
//    private String password = "123456";
//    public void loginInfo(String userName, String password) {
//        if (!this.userName.equals(userName)) {
//            System.out.println("⽤户名错误！");
//            return;
//        }
//        if (!this.password.equals(password)) {
//            System.out.println(" 密码错误！");
//            return;
//        }
//        System.out.println(" 登陆成功 ");
//    }
//    public static void main(String[] args) {
//        LogIn logIn = new LogIn();
//        logIn.loginInfo("admin111", "123456");
//    }
//}
public class LogIn {
    private String userName = "admin";
    private String password = "123456";
    public void loginInfo(String userName, String password)
            throws UserNameException,PassWordException{
        if (!this.userName.equals(userName)) {
            throw new UserNameException("⽤户名错误！");
        }
        if (!this.password.equals(password)) {
            throw new PassWordException("⽤户名错误！");
        }
        System.out.println(" 登陆成功");
    }
    public static void main(String[] args) {
        try {
            LogIn login = new LogIn();
            login.loginInfo("admin", "123456");
        } catch (UserNameException e) {
            e.printStackTrace();
        } catch (PassWordException e) {
            e.printStackTrace();
        }
        }
    }